<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This file documents the use of the GNU compilers.

Copyright © 1988-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below).  A copy of the license is included in the section entitled
"GNU Free Documentation License".

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Legacy type encoding (Using the GNU Compiler Collection (GCC))</title>

<meta name="description" content="Legacy type encoding (Using the GNU Compiler Collection (GCC))">
<meta name="keywords" content="Legacy type encoding (Using the GNU Compiler Collection (GCC))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Indices.html" rel="index" title="Indices">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Type-encoding.html" rel="up" title="Type encoding">
<link href="_0040encode.html" rel="next" title="@encode">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
kbd.key {font-style: normal}
span:hover a.copiable-link {visibility: visible}
ul.mark-bullet {list-style-type: disc}
-->
</style>


</head>

<body lang="en_US">
<div class="subsection-level-extent" id="Legacy-type-encoding">
<div class="nav-panel">
<p>
Next: <a href="_0040encode.html" accesskey="n" rel="next"><code class="code">@encode</code></a>, Up: <a href="Type-encoding.html" accesskey="u" rel="up">Type Encoding</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Indices.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Legacy-Type-Encoding"><span>8.3.1 Legacy Type Encoding<a class="copiable-link" href="#Legacy-Type-Encoding"> &para;</a></span></h4>

<p>Unfortunately, historically GCC used to have a number of bugs in its
encoding code.  The NeXT runtime expects GCC to emit type encodings in
this historical format (compatible with GCC-3.3), so when using the
NeXT runtime, GCC will introduce on purpose a number of incorrect
encodings:
</p>
<ul class="itemize mark-bullet">
<li>the read-only qualifier of the pointee gets emitted before the &rsquo;^&rsquo;.
The read-only qualifier of the pointer itself gets ignored, unless it
is a typedef.  Also, the &rsquo;r&rsquo; is only emitted for the outermost type.

</li><li>32-bit longs are encoded as &rsquo;l&rsquo; or &rsquo;L&rsquo;, but not always.  For typedefs,
the compiler uses &rsquo;i&rsquo; or &rsquo;I&rsquo; instead if encoding a struct field or a
pointer.

</li><li><code class="code">enum</code>s are always encoded as &rsquo;i&rsquo; (int) even if they are actually
unsigned or long.

</li></ul>

<p>In addition to that, the NeXT runtime uses a different encoding for
bitfields.  It encodes them as <code class="code">b</code> followed by the size, without
a bit offset or the underlying field type.
</p>
</div>



</body>
</html>
